<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=utf-8" />
    <title>
      6.23.&nbsp;Libcap-2.25
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body class="lfs" id="lfs-8.0">
    <div class="navheader">
      <h4>
        Linux From Scratch - Version 8.0
      </h4>
      <h3>
        第六章&nbsp;安装基本系统软件
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="acl.html" title="Acl-2.2.52">上一页</a>
          <p>
            Acl-2.2.52
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="sed.html" title="Sed-4.4">下一页</a>
          <p>
            Sed-4.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="chapter06.html" title=
          "第六章&nbsp;安装基本系统软件">返回</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Linux From Scratch - Version 8.0 ">主页</a>
        </li>
      </ul>
    </div>
    <div class="wrap" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="ch-system-libcap" name="ch-system-libcap"></a>6.23.
        Libcap-2.25
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <p>
          Libcap 软件包实现了用户空间接口获得内核中可用的 POSIX 1003.1e 标准能力(capability)。这些能力(capability)将强力的root权限分解成一系列的独立权限。
        </p>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">预计构建时间:</strong>
              <span class="segbody">少于 0.1 SBU</span>
            </div>
            <div class="seg">
              <strong class="segtitle">所需磁盘空间:</strong>
              <span class="segbody">1.3 MB</span>
            </div>
          </div>
        </div>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          6.23.1. 安装 Libcap
        </h2>
        <p>
          防止安装静态库:
        </p>
        <pre class="userinput">
<kbd class="command">sed -i '/install.*STALIBNAME/d' libcap/Makefile</kbd>
</pre>
        <p>
          编译该软件包:
        </p>
        <pre class="userinput">
<kbd class="command">make</kbd>
</pre>
        <p>
          该软件包不含测试套件.
        </p>
        <p>
          安装该软件包:
        </p>
        <pre class="userinput">
<kbd class="command">make RAISE_SETFCAP=no lib=lib prefix=/usr install
chmod -v 755 /usr/lib/libcap.so</kbd>
</pre>
        <div class="variablelist">
          <p class="title">
            <strong> make 选项的含义:</strong>
          </p>
          <dl class="variablelist">
            <dt>
              <span class="term"><em class=
              "parameter"><code>RAISE_SETFCAP=no</code></em></span>
            </dt>
            <dd>
              <p>
                该参数忽略了在安装过程中使用 <span class=
                "command"><strong>setcap</strong></span> 命令. 这避免了当内核或者文件系统不支持扩展能力(capability)时出现的安装错误。
              </p>
            </dd>
            <dt>
              <span class="term"><em class=
              "parameter"><code>lib=lib</code></em></span>
            </dt>
            <dd>
              <p>
                该参数会在 x86_64 系统上将库安装在 <code class=
                "filename">$prefix/lib</code> 而不是在 <code class=
                "filename">$prefix/lib64</code> 。在x86系统上无作用。
              </p>
            </dd>
          </dl>
        </div>
        <p>
		  该共享库需要被移动到 <code class=
          "filename">/lib</code>, 并且需要在<code class=
          "filename">/usr/lib</code>目录下生成 <code class=
          "filename">.so</code> 文件:
        </p>
        <pre class="userinput">
<kbd class="command">mv -v /usr/lib/libcap.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so</kbd>
</pre>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          <a id="contents-libcap" name="contents-libcap"></a>6.23.2. Libcap 的内容
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">安装的程序:</strong>
              <span class="segbody">capsh, getcap, getpcaps, and
              setcap</span>
            </div>
            <div class="seg">
              <strong class="segtitle">安装的库:</strong>
              <span class="segbody">libcap.so</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            简要描述
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="capsh" name="capsh"></a><span class=
                    "term"><span class=
                    "command"><strong>capsh</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    一个探索和约束能力(capability)支持的 shell 包装
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="getcap" name="getcap"></a><span class=
                    "term"><span class=
                    "command"><strong>getcap</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    获取文件具有的能力(capability)
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="getpcaps" name="getpcaps"></a><span class=
                    "term"><span class=
                    "command"><strong>getpcaps</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
					获取进程具有的能力(capability)
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="libcap" name="libcap"></a><span class=
                    "term"><code class="filename">libcap</code></span>
                  </p>
                </td>
                <td>
                  <p>
					包含用于操作POSIX 1003.1e能力(capability)的库函数
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="setcap" name="setcap"></a><span class=
                    "term"><span class=
                    "command"><strong>setcap</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
					设置文件具有的能力(capability)
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="acl.html" title="Acl-2.2.52">上一页</a>
          <p>
            Acl-2.2.52
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="sed.html" title="Sed-4.4">下一页</a>
          <p>
            Sed-4.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="chapter06.html" title=
          "第六章&nbsp;安装基本系统软件">返回</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Linux From Scratch - Version 8.0 ">主页</a>
        </li>
      </ul>
    </div>
  </body>
</html>
